package base.thread.threadCommunication.guanChengFa;

/**
 * @Author: my_code
 * @Create: 2020-12-09 13:06
 */
public class Product extends Thread{
    SynContainer container;

    public Product(SynContainer container) {
        this.container = container;
    }

    @Override
    public void run() {
        int id = 0;
        while (true){
            container.push(new Cake(id));
            System.out.println("生产者生成了："+id+"号蛋糕");
            id++;
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
